package com.smh.demo1.a23;

import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * @author shiminghui
 * @date 2025/5/3 9:09
 * @description: TODO
 */
@Configuration
public class WebConfig {
    @ControllerAdvice
    public static class MyControllerAdvice {

        @ModelAttribute("a")
        public String init() {
            return "init";
        }

    }

    @Controller
    public static class Controller1 {
        @ModelAttribute("b")
        public String init() {
            return "init";
        }

        @ResponseStatus(HttpStatus.OK)
        @RequestMapping("/test")
        public void test(@ModelAttribute("c") String c) {
            System.out.println(c);
        }
    }

}
